home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 60750 / 60750.xpi / chrome / chromeFiles / content / bindings / btboombutton.xml < prev    next >
Extensible Markup Language  |  2010-01-20  |  3KB  |  85 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings id="btbuttonBindings"
  4.       xmlns="http://www.mozilla.org/xbl"
  5.       xmlns:html="http://www.w3.org/1999/xhtml"
  6.       xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  7.       xmlns:xbl="http://www.mozilla.org/xbl">
  8.  
  9.   <binding id="btboombutton" extends="xul:box">
  10.     <content>
  11.       <xul:hbox>
  12.         <xul:button anonid="btboombutton-button"/>
  13.         </xul:hbox>
  14.     </content>
  15.     <handlers>
  16.       <handler event="command">
  17.         <![CDATA[
  18.           var subject = {};
  19.           subject.wrappedJSObject = this.brandObject;
  20.           this.observerService.notifyObservers(subject, "brandthunder", event.target.id);
  21.           if (this.url) {
  22.             this.brandObject.utilities.openLink(this.brandObject, event, this.url);
  23.           }
  24.         ]]>
  25.       </handler>
  26.     </handlers>
  27.     <implementation>
  28.       <constructor>
  29.         <![CDATA[
  30.         this.observerService = Components.classes["@mozilla.org/observer-service;1"]
  31.                                          .getService(Components.interfaces.nsIObserverService);
  32.  
  33.         if (this.hasAttribute('btBoomBundle')) {
  34.           this.btBoomBundle = document.getElementById(this.getAttribute('btBoomBundle'));
  35.         }
  36.         if (this.hasAttribute('brand')) {
  37.           this.brandObject = BrandThunder.clients[this.getAttribute('brand')];
  38.         }
  39.         
  40.         if (this.brandObject) {
  41.           this.btPrefBranch = Components.classes["@mozilla.org/preferences-service;1"]
  42.                                         .getService(Components.interfaces.nsIPrefService)
  43.                                         .getBranch("extensions.brandthunder.");
  44.         }
  45.         if (this.btBoomBundle) {
  46.           var url = this.getString(this.id + ".url");
  47.           if (url) {
  48.             this.url = url;
  49.           }
  50.         }
  51.         if (this.btPrefBranch && this.hasAttribute("image")) {
  52.           var currentBoom = this.btPrefBranch.getCharPref("currentBoom");
  53.          document.getAnonymousElementByAttribute(this, 'anonid', 'btboombutton-button')
  54.                  .setAttribute("image", "chrome://" + this.brandObject.packageName + "/skin/" +
  55.                             currentBoom + "/" + this.getAttribute("image"));
  56.         }
  57.         ]]>
  58.       </constructor>
  59.       <destructor>
  60.       </destructor>
  61.       <field name="btPrefBranch"/>
  62.       <field name="brandObject"/>
  63.       <field name="btBoomBundle"/>
  64.       <field name="url"/>
  65.       <field name="sidebar"/>
  66.       <field name="observerService"/>
  67.       <method name="getString">
  68.         <parameter name="id"/>
  69.         <body>
  70.           <![CDATA[
  71.           var string;
  72.           if (this.btBoomBundle) {
  73.             try {
  74.               string = this.btBoomBundle.getString(id);
  75.             } catch(ex) {
  76.             }
  77.           }
  78.           return string;
  79.           ]]>
  80.         </body>
  81.       </method>
  82.     </implementation>
  83.   </binding>
  84. </bindings>
  85.